﻿using System;

namespace Gonte.Caching
{
    /// <summary>
    /// Base class for the expiration policies
    /// </summary>
    public abstract class ExpirationPolicy
    {
        #region Overridables

        /// <summary>
        /// Called when an item is added to the cache
        /// </summary>
        /// <param name="key">The key of the item</param>
        public abstract void NotifyItemAdded(string key);

        /// <summary>
        /// Called when the item is retrieved from the cache
        /// </summary>
        /// <param name="key">The key of the item</param>
        public abstract void NotifyItemFetched(string key);

        /// <summary>
        /// Called when the items is either added or replaced in the cache
        /// </summary>
        /// <param name="key">The key of the item</param>
        public abstract void NotifyItemSet(string key);

        /// <summary>
        /// Called when the items is removed from the cache
        /// </summary>
        /// <param name="key">The key of the item</param>
        public abstract void NotifyItemRemoved(string key);

        #endregion

        #region Properties

        public Cache Cache
        {
            get { return cache_; }
            set { cache_ = value; }
        } 

        #endregion

        #region Fields

        protected Cache cache_; 

        #endregion
    }
}
